package ZMJ;

import java.awt.BorderLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextField;

public class xiugai2 extends JFrame implements ActionListener {

	JButton b1, b2;
	JTextField jt1, jt2;
	JLabel jl1, jl2, jl3;
	JPanel p1, p2, p3, p4, p5;

	public xiugai2() {
		super("单词修改");
		b1 = new JButton("确认修改");
		b2 = new JButton("返回首页");
		b1.addActionListener(this);
		b2.addActionListener(this);
		jt1 = new JTextField(15);
		jt2 = new JTextField(15);

		jl1 = new JLabel("请 输 入 单 词 编 号");
		jl2 = new JLabel("请输入修改后英文");

		p1 = new JPanel();
		p2 = new JPanel();

		p4 = new JPanel();
		p5 = new JPanel();
		p1.add(jl1);
		p1.add(jt1);
		p2.add(jl2);
		p2.add(jt2);

		p4.add(b1);
		p4.add(b2);
		p5.add(p1, BorderLayout.NORTH);
		p5.add(p2, BorderLayout.CENTER);

		this.add(p5, BorderLayout.CENTER);
		this.add(p4, BorderLayout.SOUTH);
		// this.pack();// 自适应
		// this.setDefaultCloseOperation(EXIT_ON_CLOSE);
		this.setVisible(true);
		this.setSize(300, 250);
		// this.setLocationRelativeTo(null);//对话框居中
	}

	public void actionPerformed(ActionEvent e) {
		if (e.getSource() == b1) {
			String english;
			int id;
			id = Integer.parseInt(jt1.getText());
			english = jt2.getText();
			WordUtil.englishdelet(id, english);

		}
		if (e.getSource() == b2) {
			dispose();
			new danci();
		}

	}

	// public static void main(String[] args) {
	// // TODO Auto-generated method stub
	// new xiugai2();
	// }
}
